/**
 * 创建人：王曙光
 * 创建时间：2011-9-10
 * 功能描述：界面渲染
 */
$(function() {
	/*最小化和关闭按钮*/
	$(".min,.close").live("mouseenter", function(event) {
		event.stopPropagation();
		Const._isdrag = false;
		$(this).css({
			"background-position" : "-12px 0px"
		});
	});
	$(".min,.close").live("mouseleave", function(event) {
		event.stopPropagation();
		Const._isdrag = true;
		$(this).css({
			"background-position" : "0px 0px"
		});
	});
	$(".min,.close").live("mousedown", function(event) {
		event.stopPropagation();		
		$(this).css({
			"background-position" : "-24px 0px"
		});
	});
	$(".min,.close").live("mouseup", function(event) {
		event.stopPropagation();
		Const._isdrag = true;
		$(this).css({
			"background-position" : "0px 0px"
		});
	});
	/*输入框*/
	$(".tbox").live("mouseenter", function() {
		$(this).css({
			"border" : "solid 1px #508CDD",
			"-webkit-box-shadow" : "0px 0px 5px #A6CDEF"
		});
	});
	$(".tbox").live("mouseleave", function() {
		$(this).css({
			"border" : "solid 1px #C5C5C5",
			"-webkit-box-shadow" : ""
		});
	});
	/*普通按钮*/
	$(".btn").live("mouseenter", function() {
		$(this).css({
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#93E78B), to(#59B22E))"
		});
	});
	$(".btn").live("mouseleave", function() {
		$(this).css({
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#74D46C), to(#47A414))"
		});
	});
	$(".btn").live("mousedown", function() {
		$(this).css({
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#47A414), to(#74D46C))"
		});
	});
	$(".btn").live("mouseup", function() {
		$(this).css({
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#74D46C), to(#47A414))"
		});
	});
	//次要按钮
	$(".subbtn").live("mouseenter", function() {
		$(this).css({
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#F6F8F9), to(#DADADE))"
		});
	});
	$(".subbtn").live("mouseleave", function() {
		$(this).css({
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#fff), to(#EDEDEF))"
		});
	});
	$(".subbtn").live("mousedown", function() {
		$(this).css({
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#EDEDEF), to(#fff))"
		});
	});
	$(".subbtn").live("mouseup", function() {
		$(this).css({
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#fff), to(#EDEDEF))"
		});
	});
	/*功能按钮*/
	$(".main_header_line div[id]").bind("mouseenter", function() {
		if($(this).attr("flag") == 1)
			return;
		$(this).css("background-position", "-25px 0px");
	});
	$(".main_header_line div[id]").bind("mouseleave", function() {
		if($(this).attr("flag") == 1)
			return;
		$(this).css("background-position", "0px 0px");
	});
	$(".main_header_line div[id]").bind("mousedown", function(event) {
		event.stopPropagation();
		if(this.id == 'wdiaryImg')
			return;
		$(".main_header_line div[id]").attr("flag", "0");
		$(".main_header_line div[id]").css("background-position", "0px 0px");
		$(this).attr("flag", "1");
		$(this).css("background-position", "-50px 0px");
	});
	/*底部按钮*/
	$(".to_top").bind("mouseenter", function() {
		$(this).css("background-position", "-94px 0px");
	});
	$(".to_top").bind("mouseleave", function() {
		$(this).css("background-position", "0px 0px");
	});
	$(".to_top").bind("mousedown", function() {
		$(this).css("background-position", "-188px 0px");
	});
	$(".to_top").bind("mouseup", function() {
		$(this).css("background-position", "-94px 0px");
	});
	/*功能按钮*/
	$(".funBtn").live("mouseenter", function() {
		$(this).css({
			"border" : "solid 1px #ccc",
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#f8f8f8), to(#e9e9e9))"
		})
	});
	$(".funBtn").live("mouseleave", function() {
		$(this).css({
			"border" : "solid 1px transparent",
			"background" : ""
		})
	});
	$(".funBtn").live("mousedown", function() {
		$(this).css({
			"border" : "solid 1px #ccc",
			"background" : "-webkit-gradient(linear, 0 0, 0 100% , from(#e9e9e9), to(#f8f8f8))"
		});
	});
	$(".funBtn").live("mouseup", function() {
		$(this).css({
			"border" : "solid 1px transparent",
			"background" : ""
		});
	})
	/*屏蔽右键*/
	document.oncontextmenu = new Function("event.returnValue=false;");
	
	/*总在最前*/
	var configinfo = App.getConfig();
	if(configinfo.AlwaysInFront == 1) {
		window.nativeWindow.alwaysInFront = true;		
	} else {
		window.nativeWindow.alwaysInFront = false;		
	}	
});
